#ifndef _REACTORDEF_H_
#define _REACTORDEF_H_
#include "SimpleRefection.h"
#include "MgrBase.h"
class Validator;
class EventConditionBase;
struct ReactorTypeDef;
class Affection;
struct  ReactorDef:public ReflectionBase
{
	DECL_REFLECTION(ReactorDef,"../../config/ReactorDef.xml");
	ReactorDef()
		:m_pValidator(NULL)
		,m_pEventConditon(NULL)
		,m_iCostHn(0)
	{
	}

	int32 m_iID;
	std::string m_sDisplayName;
	int32 m_iTypeID;
	int32 m_iLvel;

	ECombatEvent m_eMatchEventID;
	int32 m_iValidatorID;
	int32 m_iEventConditonID;

	int32 m_iLifeTurn;
	bool m_bAsBuff;
	int32 m_iBuffRes;
	
	int32 m_iHpMaxAdd;
	float m_fHpAddPercent;
	int32 m_iAtkAdd;
	float m_fAtkAddPercent;

	std::vector<int32> m_vExcludeTypes;
	bool m_bExludeSameType;
	bool m_bExludeSameSender;
	bool m_bExludeCampeLvl;

	bool  m_bSeries;
	int32 m_iAffection1;
	int32 m_iAffection2;
	int32 m_iAffection3;
	int32 m_iAffection4;
	int32 m_iAffection5;

	std::string m_sDesc;
	std::string m_sName;

	int32 m_iExpToNextLvl;
	int32 m_iCostHn;
	
	const Validator * m_pValidator;	
	const EventConditionBase * m_pEventConditon;
	std::vector<const Affection*> m_vAffections;
	const ReactorTypeDef * m_pType;

	rewrite virtual void OnArchieveReaded();
};
typedef DefMangerTpl<ReactorDef> __ReactorDefManager;

class ReactorDefManager:public __ReactorDefManager
{
public:
	static ReactorDefManager& Instance()
	{
		static ReactorDefManager _instance;
		return _instance;
	}

	const ReactorDef * LookupReactorDefByLvl(int32 iType,int32 iLevel) const ;
	virtual void OnArchieveReaded();
private:
	ReactorDefManager(){}
	std::map<int32,const ReactorDef *> m_mIndexs;
};

#endif